package com.feihong.yw189.paidan.dialog;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.feihong.yw189.R;
import com.feihong.yw189.paidan.view.PaiDanSmTextView;


/**
 * 2017/2/17.
 * 提示(账号绑定)
 */

public class PaiDanShuoMingDialog extends Dialog {

    private TextView goSmrz;
    private PaiDanSmTextView tv_content;
    private PaiDanSmTextView tv_content1;
    private Activity context;
    private String gdName;
    private String note;

    public PaiDanShuoMingDialog(Context context) {
        super(context, R.style.QiaoDaoDialogStyle);
        this.context = (Activity) context;
    }

    public void setContent(String gdName, String note) {
        this.gdName = gdName;
        this.note = note;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pdsm_dialog);
        goSmrz = (TextView) findViewById(R.id.go_smrz);
        Log.e("项目异常onCreate", gdName + "------1------" + note);
        tv_content = (PaiDanSmTextView) findViewById(R.id.tv_content);
        tv_content1 = (PaiDanSmTextView) findViewById(R.id.tv_content1);
//        tv_content.setTextColor(Color.parseColor("#FCB075"));
//        tv_content1.setTextColor(Color.parseColor("#FCB075"));
        if (gdName != null && !TextUtils.isEmpty(gdName)) {
            tv_content.setText(gdName);
        }
        if (note != null && !TextUtils.isEmpty(note)) {
            tv_content1.setText(StringFilter(note));
        }

        goSmrz.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                cancel();
            }
        });
    }

    /**
     * @param str String类型
     * @return String
     * @Description 替换、过滤特殊字符
     */
    public static String StringFilter(String str) {
        str = str.replaceAll(" ", "").replaceAll("、", ",");//替换中文标号
        return str.replaceAll(" ", "").trim();
    }
}
